import { Unitl } from "../Unitl";
Unitl.PrintStartTime();

Unitl.PrintOpeationName("抽象类");

abstract class Animal{
    public abstract name:string;
    public abstract Loud():void;
    public  Move():void{
        console.log("Move");
    };
}

class Dog extends Animal{
    public name: string = "Dog";
    public Loud(): void {
    console.log("狗叫！");
    }
};

const _dog = new Dog();
console.log(_dog.name);
_dog.Loud();
_dog.Move();

/*
抽象类这里要考虑的，就是属性前面加abstract,子类才能实现抽象属性
*/
Unitl.PrintOpeationName("类实现接口");
interface IMain{
 
    Func():void;
}

class InterClass implements IMain{
    public Func(): void {
        console.log("Func!");
    }
}

const _interClass = new InterClass();
_interClass.Func();


Unitl.PrintOpeationName("泛型类");
class ClassGen<K,V>{
    public key:K[] = [];
    public val:V[] = [];

    Has_K(key:K[]):K[]{

        return  key;
    }

    Has_V(val:V[]):V[]{

        return  val;
    }
}
const _class = new ClassGen<string,number>();

for(let i = 0;i < 3;i++){
console.log(_class.Has_K(["A","B","C"])[i]);
};

for(let i = 0;i < 3;i++){
console.log(_class.Has_V([5,7,9])[i]);
};
/*
泛型类，没什么好说的
*/